package com.wy.framework.actions.user;

import org.apache.commons.lang3.StringUtils;
import org.apache.struts2.ServletActionContext;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;

import com.opensymphony.xwork2.Action;
import com.wy.framework.actions.AbstractBaseAction;
import com.wy.framework.constants.RtnCodeConstant;
import com.wy.framework.exceptions.ServiceException;
import com.wy.framework.services.user.UserManageService;

/**
 * 项目名称：openportal
 * 类名称：EditUserAction
 * 类描述：修改用户控制器
 * 创建人：张旭星
 * 创建时间：2015-12-28 下午8:06:03
 * 修改人：张旭星
 * 修改时间：2015-12-28 下午8:06:03
 * 版本信息：@version 1.0
 * Copyright (c) 2015万雍科技（上海）有限公司-版权所有  
 * 修改备注：
 * @version 
 */
public class EditUserAction extends AbstractBaseAction {
	private static final long serialVersionUID = 1L;

	private static Logger logger = LoggerFactory
			.getLogger(EditUserAction.class);

	@Autowired
	private UserManageService userManageService;
	
	@Override
	public String execute() throws ServiceException {
//		userManageService.updateUserInfo(userInfo);
		return "success";
	}

	public String updateUserInfo() throws ServiceException{
		String userAccount=ServletActionContext.getRequest().getParameter("userAccount");
		String property=ServletActionContext.getRequest().getParameter("property");
		String content=ServletActionContext.getRequest().getParameter("content");
		rspCode=userManageService.updateUserInfo(userAccount, property, content);
		if (StringUtils.equals(rspCode, RtnCodeConstant.RTN_CODE_SUCCESS)) {
			rspMsg="修改成功";
		}else {
			rspMsg=rspCode;
			rspCode=RtnCodeConstant.RTN_CODE_D03_NO_EXIST_ERROR;
		}
		return Action.SUCCESS;
	}
	
}
